package com.jimmy.tx.service.impl;

import com.jimmy.tx.dao.AccountDao;
import com.jimmy.tx.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @version 1.0
 * @ ClassName AccountServiceImpl
 * <p> TODO
 * @ author JIMMY
 * @ Date 2020/12/9 0009 上午 11:54
 */
@Service("accountService")
public class AccountServiceImpl implements AccountService {
    @Autowired
    private AccountDao accountDao;

    @Transactional
    public void transfer(String from, String to, Double money) {
        accountDao.outMoney(from,money);
        int i =1/0;
        accountDao.inMoney(to,money);
    }
}
